package com.lolo.sso.execption;

import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;

@ControllerAdvice
@RestController
public class GlobalExceptionHandler {

    @ExceptionHandler(TokenMissingException.class)
    @ResponseStatus(HttpStatus.UNAUTHORIZED)
    public String handleTokenMissingException(TokenMissingException ex) {
        return ex.getMessage();
    }
}
